﻿using Hangfire.Dashboard;

namespace Demo.HangfireIntergation.Filters
{
    public class HangfireAuthorizationFilter : IDashboardAuthorizationFilter
    {
        public bool Authorize(DashboardContext context)
        {
            var httpContext = context.GetHttpContext();
            // 实现你的授权逻辑，例如检查用户角色或权限
            return httpContext.User.Identity.IsAuthenticated
                   && httpContext.User.IsInRole("Administrator");
        }
    }

}
